const express = require('express');
const router = express.Router();
const userController = require('../controllers/userController');
const authMiddleware = require('../middleware/authMiddleware');

// 用户注册
router.post('/register', userController.registerUser);

// 用户登录
router.post('/login', userController.loginUser);

// 用户退出登录
router.post('/logout', authMiddleware.authenticateToken, userController.logoutUser);

// 获取当前用户信息
router.get('/profile', authMiddleware.authenticateToken, userController.getCurrentUser);

// 更新用户信息
router.put('/profile', authMiddleware.authenticateToken, userController.updateUser);

// 修改密码
router.put('/password', authMiddleware.authenticateToken, userController.changePassword);

// 获取用户偏好设置
router.get('/preferences', authMiddleware.authenticateToken, userController.getUserPreferences);

// 更新用户偏好设置
router.put('/preferences', authMiddleware.authenticateToken, userController.updateUserPreferences);

// 获取通知设置
router.get('/notifications', authMiddleware.authenticateToken, userController.getNotificationSettings);

// 更新通知设置
router.put('/notifications', authMiddleware.authenticateToken, userController.updateNotificationSettings);

// 获取用户统计数据
router.get('/statistics', authMiddleware.authenticateToken, userController.getUserStatistics);

// 获取能源使用报告
router.get('/reports/energy', authMiddleware.authenticateToken, userController.getEnergyUsageReport);

// 获取舒适度报告
router.get('/reports/comfort', authMiddleware.authenticateToken, userController.getComfortReport);

// 获取用户活动历史
router.get('/history', authMiddleware.authenticateToken, userController.getUserActivityHistory);

module.exports = router;